<template>
  <div class="item-search-page">
    <div class="search">
      <div><input v-model="inputVal" :autofocus="true" type="text" placeholder="请输入搜索关键词"></div>
      <div class="search-icon" @click="submitSearch"><img src="@/assets/search1.png"></div>
    </div>

    <!-- <div v-if="searchRes.length===0" class="container">
      <div v-show="inputVal.length>0">没有查询到您搜索的商品！</div>
    </div> -->
  </div>
</template>

<script>
// vant
import { Toast } from 'vant'
export default {
  data() {
    return {
      inputVal: '',
      searchRes: []
    }
  },
  methods: {
    async submitSearch() {
      if (!this.inputVal) {
        console.log('没有内容')
        Toast('请输入正确的搜索内容')
        return
      }
      this.$router.push({ name: 'serachProduct', query: { kw: this.inputVal }})
    }
  }
}
</script>

<style lang="less">
.item-search-page {
  width: 100%;
  height: calc(100vh - 45px);
  background: #fff;
  .search {
    position: relative;
    width: 100%;
    padding: 0 3vw 1vw;
    box-sizing: border-box;
    margin: 0 auto;
    height: 15vw;
    display: flex;
    background: #f5f6f8;
    justify-content: space-between;
    align-items: center;
    input {
      width: 320px;
      height: 30px;
      line-height: 30px;
      border: none;
      background: #fff;
      border-radius: 15px;
      padding: 3px 5px;
      font-size: 12px;
    }
    .search-icon {
      position: absolute;
      top: 6px;
      right: 3%;
      width: 65px;
      img {
        width: 100%;
      }
    }
  }
  .container {
    // height: 100vh;
    background: #fff;
    text-align: center;
    padding: 30px 0;
    font-size: 14px;
    color: #999999;
  }
}
</style>
